package com.example.resourceSharingPlatform.mappers;

import com.example.resourceSharingPlatform.entity.Item;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class ItemRowMapper implements RowMapper<Item> {
    @Override
    public Item mapRow(ResultSet rs, int i)throws SQLException {
        Item item = new Item();
        item.setId(rs.getInt("id"));
        item.setName(rs.getString("name"));
        item.setType(rs.getString("type"));
        item.setBorrow_state(rs.getString("borrow_state"));
        item.setCheck_state(rs.getString("check_state"));
        item.setPicture(rs.getString("picture"));
        item.setPrice(rs.getDouble("price"));
        item.setDescription(rs.getString("description"));
        item.setOwner_id(rs.getString("owner_id"));
        item.setValuation(rs.getString("valuation"));
        return item;
    }
}
